%
% Vasyl Mykhalchuk
%
% INPUT
% path - path to exported file
% fps - feature points (indices)
% geometry - geometry of mesh ( nVert by 3 matrix of vertex coordinates)
% id - identificator of the mesh and field (e.g. horse-mean-strain, female-curv, face-max-strain etc.)
function [ notEmpty ] = exportFP( fps, field, path, id )

% PREPROCESS
fps = fps';
n = size(fps, 1); % NUMBER OF FEATURE POINTS
if ( fps(1, 1) == 0 )
    notEmpty = 0;
    return;
end % if
% END PREPROCESS

% OPEN FILE FOR WRITING
[fid, msg] = fopen(path, 'wt');
if ( fid == -1) error(msg); end % IF
% WRITE HEADER
fprintf(fid, '%% Mesh id ''%s'' \n', id);
fprintf(fid, '%d', n);
% WRITE BODY
for i = 1:n
    fpId = fps(i, 1);
    fprintf(fid, '\n%d %6.4f', fpId, field( fpId ) );
end % FOR
% CLEANUP RESOURCES
fclose(fid);

notEmpty = 1;

end % FUNCTION

